sort objects into three groups